<?php
$baseUrl = $this->baseUrl();
?>
<form id="dataform" class="uniForm" action="javascript:submit();"  style="padding:0.5em 1em 1em 1.5em;">
        <h2>Property Submission</h2>
        <hr/>
         <div class="ctrlHolder noLabel">
		          <ul class="alternate">
		            <li><label for=""><em>*</em> First Name</label>
		          <input name="fname" id="fname" data-default-value="e.g. Ravi" size="10" maxlength="50" type="text" class="textInput required"/></li>
		            <li><label for=""> Middle Name</label>
		          <input name="mname" id="mname" data-default-value="e.g. Kumar" size="10" maxlength="50" type="text" class="textInput"/></li>
		            <li><label for=""> <em>*</em>Last Name</label>
		          <input name="lname" id="lname" data-default-value="e.g. Gupta" size="10" maxlength="50" type="text" class="textInput required"/></li>
		          </ul>
		          <p class="formHint">Full Name of Owner</p>
		</div>

		        <div class="ctrlHolder">
		          <label for=""><em>*</em> Owner Contact Number</label>
		          <input name="owner_contact_no" id="owner_contact_no" data-default-value="e.g. 9896102030" size="35" maxlength="50" type="text" class="textInput required"/>
		          <p class="formHint">Contact Number of <span class="cName" >Owner</span></p>
		        </div>
		        <div class="ctrlHolder">
		          <label for=""><em>*</em> Owners Address</label>
		          <textarea name="owner_address" id="owner_address" data-default-value="#007, Subhash colony,Faridabad" cols="10" rows="10"  class="textInput required"></textarea>
		          <p class="formHint">Address of <span class="cName" >Owner</span></p>
		        </div>
		        
      <div class="ctrlHolder">
                <label for=""><em>*</em> Category</label>
                <select name="category" id="category" class="selectInput">
              		<option value="RES" selected="selected" >Residential</option>
              		<option value="COM">Commercial</option>
      	  		</select>
                <p class="formHint">Category of <span class="cName" >Propery</span></p>
              </div>

              <div class="ctrlHolder">
              <label for=""><em>*</em> Type</label>
              <select name="type" id="type" class="selectInput">
            		<option value="FLAT" selected="selected" >Flat</option>
            		<option value="PLOT">Plot</option>
            		<option value="SHOP">Shop</option>
    	  		</select>
              <p class="formHint">Type of <span class="cName" >Propery</span></p>
            </div>

            <div class="ctrlHolder">
            <label for=""><em>*</em> Status of property</label>
            <select name="status" id="status" class="selectInput">
          		<option value="NEW" selected="selected" >New</option>
          		<option value="RESAL">Resale</option>
          		<option value="RENT">Rent</option>
  	  		</select>
            <p class="formHint">Type of <span class="cName" >Propery</span></p>
          </div>
          
              <div class="ctrlHolder">
                <label for=""><em>*</em>Size</label>
                <input name="size" id="size" data-default-value="" size="35" maxlength="50" type="text" class="textInput required"/>
                <p class="formHint">Size of <span class="cName" >Property</span> in sq.ft.</p>
              </div>
              
              <div class="ctrlHolder">
                <label for=""><em>*</em>BHK</label>
                <input name="bhk" id="bhk" data-default-value="e.g. 3" size="35" maxlength="50" type="text" class="textInput required"/>
                <p class="formHint">BHK of <span class="cName" >Property</span></p>
              </div>
              
              <div class="ctrlHolder">
                <label for=""><em>*</em>Count</label>
                <input name="count" id="count" data-default-value="1" size="35" maxlength="50" type="text" class="textInput required"/>
                <p class="formHint">Count of <span class="cName" >Property</span></p>
              </div>
              
              <div class="ctrlHolder">
                <label for=""><em>*</em>Rate</label>
                <input name="rate" id="rate" data-default-value="8000" size="35" maxlength="50" type="text" class="textInput required"/>
                <p class="formHint">Rate for <span class="cName" >Property</span> in /sq.ft.</p>
              </div>
              
              <div class="ctrlHolder">
                <label for=""><em>*</em>Location</label>
                <input name="location" id="location" data-default-value="e.g. 365, Model Town" size="35" maxlength="50" type="text" class="textInput required"/>
                <p class="formHint">Location of <span class="cName" >Property</span></p>
              </div>
              
              <div class="ctrlHolder">
                <label for=""><em>*</em>State</label>
                <input name="state" id="state" data-default-value="e.g. Haryana" size="35" maxlength="50" type="text" class="textInput required"/>
                <p class="formHint">State of <span class="cName" >Property</span></p>
              </div>
              
              <div class="ctrlHolder">
                <label for=""><em>*</em>City</label>
                <input name="city" id="city" data-default-value="e.g. Ambala City" size="35" maxlength="50" type="text" class="textInput required"/>
                <p class="formHint">City of <span class="cName" >Property</span></p>
              </div>
              
              <div class="ctrlHolder">
                <label for=""><em>*</em>Summary</label>
                <input name="summary" id="summary" data-default-value="Well furnished,24hour services,near bus stand...etc" size="35" maxlength="50" type="text" class="textInput required"/>
                <p class="formHint">Summary of <span class="cName" >Property</span></p>
              </div>
              
              <div class="buttonHolder">
                <button type="submit" class="secondaryAction">Cancel and go back</button>
                <button type="submit" class="primaryAction">Submit</button>
              </div>
 </form>
 <div id="submitStatus" style="display:none;" class="ui-state-highlight ui-corner-all" ></div>
    <script>
	var urlPropertyRegister = "<?php echo $this->url(array('controller' => 'sell', 'action' => 'register'))?>";
	
      $(function(){
        $('form.uniForm').uniform({
          prevent_submit : true
        });

      });
      function submit() {
            $.ajax({
                url : urlPropertyRegister,
                data : getValues(),
                success: function(jStatus){
                    $( "#submitStatus" ).text(jStatus).toggle( 'blind', '', 'slow', function(){
                        scroll(this);
                      	setTimeout(function(){
                          	window.location.reload();
                          	},1700);
                      } );
                  },
                    error: function(response) {
                  	  $('#errorBox').text(response.responseText).parent().show();
                        console.log(response);
                        }
                    });
            }
        function getValues() {
            var formData = {oper:'add'}; 
            $('#dataform :input')
            		.not('button')
            		.each(function(){
            			formData[this.name] = this.value; 
                });
  			return formData;
  		}
        function scroll(destination){
        	var pos = $(destination).offset().top;
        	pos -= 100;
        	$('html, body').animate({
        	scrollTop: pos
        	}, 'slow');
        }
        </script>
<?php
$this->headScript()->appendFile($baseUrl.'/plugins/uni-form/js/uni-form-validation.jquery.js');
$this->headLink()->prependStylesheet($baseUrl.'/plugins/uni-form/css/uni-form.css');
$this->headLink()->prependStylesheet($baseUrl.'/plugins/uni-form/css/smooth.uni-form.css');
$this->headLink()->prependStylesheet($baseUrl.'/plugins/uni-form/demos/css/demo.css');
?>